import axios from '../config.js'

/**
 * 获取商品列表
 * @param {Integer} categoryId 分类ID
 * @param {Integer} page 页码
 * @param {String} sort 排序
 * @param {String} keyword 关键词
 */
export function getGoodsList(categoryId, frequencyId, goodsLevelId, goodsPowerId, page, sort, keyword) {
    const url = '/mobile/goods/goodsList'
    const data = {
        categoryId: categoryId,
        frequencyId: frequencyId,
        goodsLevelId: goodsLevelId,
        goodsPowerId: goodsPowerId,
        page: page,
        sort: sort,
        keyword: keyword
    }
    return axios.get(url, { params: data })
}
// 商品详情
export function getGoodsInfo(goodsId) {
    const url = '/mobile/Goods/goodsDetail'
    const data = {
        goods_id: goodsId
    }
    return axios.post(url, data)
}
//获取省市区地址
export function getStoreArea(type,province_code,city_code,district_code) {
    const url = '/mobile/Goods/getStoreArea';
    const data = {
        type: type,
        province_code: province_code,
        city_code: city_code,
        district_code: district_code
    }
	return axios.post(url,data);
}

//切换地址获取库存
export function getStore(province_code,city_code,section_code,street,goods_code) {
    const url = '/mobile/Goods/getStore';
    const data = {
        province_code: province_code,
        city_code: city_code,
        section_code: section_code,
        street: street,
        goods_code: goods_code
    }
	return axios.post(url,data);
}

//切换地址获取库存
export function getProvince() {
    const url = '/mobile/goods/memberCenterGetDistrict';
//  const data = {
//      province_code: province_code,
//      city_code: city_code,
//      section_code: section_code,
//      street: street,
//      goods_code: goods_code
//  }
	return axios.post(url);
}

//切换地址获取库存
export function getFiltrateList() {
    const url = '/mobile/Goods/goodsScreenCate';
	return axios.get(url);
}
